import { cloud, default as request } from '@/framework/utils/request'

/**
 * @description: 商品详情 /goods/detail
 * @param data
 */
export function GoodsDetail(data) {
  return request({
    url: `${cloud.mall}/goods/detail`,
    method: 'get',
    params: data
  })
}

/**
 * @description: 加入购物车 /tMgdShopcar/insert
 * @param data
 */
export function addShopCar(data) {
  return request({
    url: `${cloud.mall}/tMgdShopcar/insert`,
    method: 'post',
    data
  })
}

/**
 * @description: 商品view数据 /tMgdView/add
 * @param data
 */

export function addView(data) {
  return request({
    url: `${cloud.mall}/tMgdView/add`,
    method: 'post',
    data
  })
}

/**
 * @description: 收藏数据 /tMgdCollect/add
 * @param data
 */
export function addCollect(data) {
  return request({
    url: `${cloud.mall}/tMgdCollect/add`,
    method: 'post',
    data
  })
}

/**
 * @description: 点击购买 /tModOrder/to-order-sure
 * @param data
 */
export function toOrderSure(data) {
  return request({
    url: `${cloud.mall}/tModOrder/to-order-sure`,
    method: 'post',
    data
  })
}

/**
 * @description: 店长推荐 /goods/recommend
 * @param data
 */
export function recommend(data) {
  return request({
    url: `${cloud.mall}/goods/recommend`,
    method: 'get',
    params: data
  })
}

/**
 * @description: 店铺信息 /tMallInfo/getMallBaseInfo
 * @param data
 */
export function getMallBaseInfo(data) {
  return request({
    url: `${cloud.mall}/tMallInfo/getMallBaseInfo`,
    method: 'get',
    params: data
  })
}

/**
 * @description: 个人资料 /user/detail
 * @param data
 */
export function userDetail(data) {
  return request({
    url: `${cloud.mall}/user/detail`,
    method: 'get',
    params: data
  })
}

/**
 * @description: 修改用户信息 /sysUserEdit
 * @param data
 */
export function sysUserEdit(data) {
  return request({
    url: `${cloud.mall}/sysUserEdit`,
    method: 'post',
    data
  })
}

/**
 * @description: 商品分类 /tMgdCategory/listFistCate
 * @param data
 */
export function listFistCate(data) {
  return request({
    url: `${cloud.mall}/tMgdCategory/listFistCate`,
    method: 'get',
    params: data
  })
}

/**
 * @Description: 是否收藏 /tMgdCollect/isCollect
 * @param data
 */
export function isCollect(data) {
  return request({
    url: `${cloud.mall}/tMgdCollect/isCollect`,
    method: 'POST',
    data
  })
}

/**
 * @Description: 删除收藏 /tMgdCollect/delete
 * @param data
 */
export function deleteCollect(data) {
  return request({
    url: `${cloud.mall}/tMgdCollect/delete`,
    method: 'POST',
    data
  })
}

/**
 * @Description: 收藏人气 /tMgdCollect/collectCount
 * @param data
 */
export function collectCount(data) {
  return request({
    url: `${cloud.mall}/tMgdCollect/collectCount`,
    method: 'get',
    params: data
  })
}

/**
 * @Description: 店铺收藏 /tMallCollect/collect
 * @param data
 */
export function mallCollect(data) {
  return request({
    url: `${cloud.mall}/tMallCollect/collect`,
    method: 'POST',
    data
  })
}
